#include<iostream>
#include<algorithm>
const int N = 1e6 + 10;
int a[N];
using namespace std;
int main()
{
	int MAX;cin >> MAX;
	int n;cin >> n;
	for(int i = 1; i <= n; i++)
	{
		cin >> a[i];
	}
	sort(a + 1, a + 1 + n);
	int left = 1, right = n;int count = 0;
	while (left <= right)
	{
		if (a[left] + a[right] > MAX)
		{
			right--;
			count++;
		}
		else
		{
			count++;
			left++;
			right--;
		}
	}
	cout << count << endl;
	return 0;
}
